import { legacy_createStore,combineReducers,compose,applyMiddleware} from 'redux'
import reduxThunk from 'redux-thunk'

import handleNum from "./NumStatus/reducer"
import handleArr from "./ArrStatus/reducer"


//combineReducers组合各个模块的reducer
const reducers = combineReducers({
    handleNum,
    handleArr
})

//创建数据仓库
// window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__())配置后可以在浏览器中运用redux-devtools
// const store = legacy_createStore(reducers, window.__REDUX_DEVTOOLS_EXTENSION__ &&
//     window.__REDUX_DEVTOOLS_EXTENSION__());
// export default store


// __REDUX_DEVTOOLS让浏览器的redux-devtools工具兼容异步操作
//__REDUX_DEVTOOLS_EXTENSION_COMPOSE__爆红  去store.d.ts里面声明一下
let composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):compose //rt

// 把仓库数据（reducers），浏览器redux-dev-tools，还有reduxThunk插件关联在store中
const store = legacy_createStore(reducers,composeEnhancers(applyMiddleware(reduxThunk))); 
export default store